import request from '@/utils/request'

export function getList(params) {
  return request({
    url: `/admin/system/user/list/${params.page}/${params.size}`,
    method: 'get',
    params: {
      keyword: params.keyword
    }
  })
}

export function login(data) {
  console.log(data)
  return request({
    url: '/admin/system/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/admin/system/user/info',
    method: 'get',
    params: { token }
  })
}

export function remove(ids) {
  console.log(ids)
  return request({
    url: '/admin/system/user/remove',
    method: 'delete',
    data: ids
  })
}

export function saveOrUpdate(data) {
  return request({
    url: '/admin/system/user/saveOrUpdate',
    method: 'post',
    data
  })
}

export function updateStatus(data) {
  return request({
    url: `/admin/system/user/updateStatus/${data.id}/${data.status}`,
    method: 'put'
  })
}

export function logout(token) {
  return request({
    url: '/admin/system/user/logout',
    method: 'post',
    data: {
      token
    }
  })
}
